<?php
	namespace app\controllers\sbb;
	use yii\web\Controller;
	use app\models\sbb\user;
	class LoginController extends Controller{
		public $enableCsrfValidation = false;
		public $layout = 'sbb/common';
		public function actionLogin(){
			return $this->render('login');
		}
		public function actionCheck_phone(){
			$model = new user;	
			$post = \yii::$app->request->post('phone_number');
			$aa = [
				'user'=>[
					'phone'=>$post,
				],
			];
			$model->load($aa);
			$model->validate();
			$errors = $model->getErrors('phone');
			//手机号码错误返回对应信息
			if(!empty($errors)){
				$errors = $model->getErrors('phone');
				if(is_array($errors)){
					foreach($errors as $error)
						return json_encode($error);
				}
				else
					return json_encode($error);
			}
			else{//返回验证码
				return true;
			}

		}
		public function actionDo_phone_verify(){
			$str = $model->get_verify_phone();
				return json_encode($str);
		}

	}
?>